package com.zlk.algorithm.huawei.nowcoder.calculate;

import java.io.*;
import java.util.Scanner;

/**
 * @program: algorithm
 * @ClassName HJ55
 * @description:
 * @author: slfang
 * @create: 2024-12-27 17:39
 * @Version 1.0
 **/
public class HJ55 {
        public static void main(String[] args){
            Scanner sc = new Scanner(System.in);
            while(sc.hasNext()){
                int n = sc.nextInt();
                int sum=0;
                for(int i = 1;i<=n;i++){
                    if(i%7==0){
                        sum++;
                    }else{
                        String s = String.valueOf(i);
                        if(s.contains("7")){
                            sum++;
                        }
                    }
                }
                System.out.println(sum);
            }
        }
    }
